<template>
  <!-- 搜索工作栏 -->
  <ContentWrap>
    <el-form ref="queryFormRef" label-width="200px" :model="formData" :rules="formRules">
      <el-form-item label="爽约判断" prop="standUpRule">
        <el-radio-group v-model="formData.standUpRule">
          <el-radio v-for="dict in standUpRuleList" :key="dict.value" :value="dict.value">
            {{ dict.label }}
          </el-radio>
        </el-radio-group>
        <el-text class="w-full" size="small" type="info"> 客户预约后的，爽约条件判断 </el-text>
      </el-form-item>
      <el-form-item label="爽约惩罚判断" prop="isStandUpRule">
        <el-radio-group v-model="formData.isStandUpRule">
          <el-radio v-for="dict in isStandUpRuleList" :key="dict.value" :value="dict.value">
            {{ dict.label }}
          </el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="未购卡会员的预约卡项数量" prop="noCardMembersAppointmentNum">
        <el-input-number
          v-model="formData.noCardMembersAppointmentNum"
          :max="100"
          :min="0"
          class="!w-xs"
        />
        <el-text class="w-full" size="small" type="info">
          卡项数量填0时，将不支持未购买卡项的会员预约
        </el-text>
      </el-form-item>
      <el-form-item label="已购卡会员的预约卡项数量" prop="cardMembersAppointmentNum">
        <el-input-number
          v-model="formData.cardMembersAppointmentNum"
          :max="100"
          :min="0"
          class="!w-xs"
        />
        <el-text class="w-full" size="small" type="info">
          卡项数量填0时，将不支持已购买卡项的会员预约
        </el-text>
      </el-form-item>
      <el-form-item label="容错时间" prop="faultToleranceTime">
        <el-input-number v-model="formData.faultToleranceTime" :min="0" class="!w-xs" />
        <el-text class="w-full" size="small" type="info"> 允许预约时的交叉时间,单位：分 </el-text>
      </el-form-item>
      <el-form-item label="未购卡会员预约支付" prop="noCardMembersAppointmentPay">
        <el-radio-group v-model="formData.noCardMembersAppointmentPay">
          <el-radio
            v-for="dict in noCardMembersAppointmentPayList"
            :key="dict.value"
            :value="dict.value"
          >
            {{ dict.label }}
          </el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="预约后是否提示" prop="isAppointmentTip">
        <el-radio-group v-model="formData.isAppointmentTip">
          <el-radio v-for="dict in isAppointmentTipList" :key="dict.value" :value="dict.value">
            {{ dict.label }}
          </el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="服务开始前是否提示" prop="isServiceTip">
        <el-radio-group v-model="formData.isServiceTip">
          <el-radio v-for="dict in isAppointmentTipList" :key="dict.value" :value="dict.value">
            {{ dict.label }}
          </el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="服务开始前提醒会员" prop="memberTipTime">
        <el-input-number v-model="formData.memberTipTime" :min="0" class="!w-xs" />
        <el-text class="w-full" size="small" type="info"> 单位：分 </el-text>
      </el-form-item>
      <el-form-item label="服务开始前提醒员工" prop="serviceTipTime">
        <el-input-number v-model="formData.serviceTipTime" :min="0" class="!w-xs" />
        <el-text class="w-full" size="small" type="info"> 单位：分 </el-text>
      </el-form-item>
      <el-form-item>
        <el-button type="primary"> 保存 </el-button>
      </el-form-item>
    </el-form>
  </ContentWrap>
</template>
<script lang="ts" name="tenantList" setup>
const emit = defineEmits(['selectTenants'])

const loading = ref(true) // 列表的加载中
const formData = ref({
  standUpRule: 0, //爽约规则
  isStandUpRule: 0, //爽约惩罚判断规则
  noCardMembersAppointmentNum: 0, //未购卡会员的预约卡项数量
  cardMembersAppointmentNum: 0, //未购卡会员的预约卡项数量
  faultToleranceTime: 0, //容错时间
  noCardMembersAppointmentPay: 0, //未购卡会员预约支付
  isAppointmentTip: 0, //预约后是否提示
  isServiceTip: 0, //服务开始前是否提示
  memberTipTime: 0, //提示会员时间
  serviceTipTime: 0 //提示员工时间
})
const formRules = reactive({
  standUpRule: [{ required: true, message: '爽约规则不能为空', trigger: 'change' }],
  isStandUpRule: [{ required: true, message: '爽约惩罚判断不能为空', trigger: 'change' }],
  noCardMembersAppointmentNum: [
    { required: true, message: '未购卡会员的预约卡项数量必填', trigger: 'blur' }
  ],
  cardMembersAppointmentNum: [
    { required: true, message: '已购卡会员的预约卡项数量必填', trigger: 'blur' }
  ],
  faultToleranceTime: [{ required: true, message: '容错时间', trigger: 'blur' }],
  noCardMembersAppointmentPay: [
    { required: true, message: '未购卡会员预约支付必填', trigger: 'blur' }
  ],
  isAppointmentTip: [{ required: true, message: '预约后是否提示不能为空', trigger: 'change' }],
  isServiceTip: [{ required: true, message: '服务开始前是否提示不能为空', trigger: 'change' }],
  memberTipTime: [{ required: true, message: '时间必填', trigger: 'blur' }],
  serviceTipTime: [{ required: true, message: '时间必填', trigger: 'blur' }]
})
const isAppointmentTipList = [
  {
    value: 0,
    label: '不提示'
  },
  {
    value: 1,
    label: '会员提示'
  },
  {
    value: 2,
    label: '员工提示'
  },
  {
    value: 2,
    label: '都提示'
  }
]
const standUpRuleList = [
  {
    value: 0,
    label: '全部'
  },
  {
    value: 1,
    label: '允许'
  },
  {
    value: 2,
    label: '不允洗'
  }
]
const isStandUpRuleList = [
  {
    value: 0,
    label: '无'
  },
  {
    value: 1,
    label: '连续爽约'
  },
  {
    value: 2,
    label: '累计爽约'
  }
]
const noCardMembersAppointmentPayList = [
  {
    value: 0,
    label: '不支付'
  },
  {
    value: 1,
    label: '线上支付'
  }
]

/** 查询列表 */
const getConfig = async () => {
  loading.value = true
  try {
    // const data = await UserApi.getUserPage(queryParams)
    // formData.value = data
  } finally {
    loading.value = false
  }
}

/** 初始化 **/
onMounted(() => {
  getConfig()
})
</script>
